Equipment and method for compressing picture data

ABSTRACT

When repeatedly performing compression and encoding of video data, automatically detecting a previous picture type at an encoder side and performing the compression and encoding by matching GOP phases. 
     A motion compensation unit 240 to a DCT unit 244 perform motion compensation, DCT, etc. on input video data to generate DCT coefficients. A back search unit 248 detects whether or not there is a relative minimum in the sum of remainders of the results of division by the quantization steps of the DCT coefficients, judges that the picture having the relative minimum has been compressed and encoded to an intra-picture in the previous compression and encoding, and judges the structure of the GOPs (a number N of pictures and an interval M of P pictures) at the previous compression and encoding. A picture type control unit 250 controls a picture rearrangement unit 200 based on the judged GOP structure to make it rearrange pictures of the input video data to an order by which a compression and encoding unit 20 can perform compression and encoding with the same GOP phase as that of the previous time.

TECHNICAL FIELD

The present invention relates to a video data compression apparatus, anda method of the same, for compressing and encoding pictures of expandedand decoded video data to pictures of the same type as that at theprevious compression and encoding when for example dubbing video data byconnecting in tandem video tape recorders (VTRs) which record video datacompressed and encoded by an MPEG method or the like and expand anddecode the reproduced video data for output.

BACKGROUND ART

In recent years, in the field of video data compression, frequent usehas been made of the MPEG2 (Moving Picture Experts Group 2) method as aso-called MC-DCT method of improving an encoding efficiency by acombination of motion compensation (MC) processing and redundancyreduction processing by discrete cosine transfer (DCT) and otherorthogonal transformation.

In this MPEG2 method, usually non-compressed video data is compressedand encoded in units of "groups of pictures" (GOPs) each containing oneintra-picture capable of being expanded and decoded without use of thepixel data of other pictures and predetermined numbers of predictivepictures (P pictures) to be expanded and decoded by using the pixel dataof the previous picture and bidirectionally predictive pictures (Bpictures) to be expanded and decoded by using the pixel data of theprevious and following pictures.

Here, for example, when transmitting video data between televisionbroadcasting stations or dubbing video data by using a plurality ofvideo tape recorders (VTRs), in order to expand and decode the videodata which has been already compressed and encoded by the MPEG2 methodand then compress and encode the same again, it is necessary toconnecting a compression and encoding apparatus (encoder) and anexpansion and decoding apparatus (decoder) in series (tandemconnection).

When repeating this compression and encoding and this expansion anddecoding of the video data in this way by repeatedly connecting intandem the encoder and the decoder, the quality of the videodeteriorates. Particularly, television broadcasting station facilitiesand other industrial use systems require a high video quality, soprevention of deterioration of the video quality along with thecompression and encoding and the expansion and decoding by atandem-connected encoder and decoder is strictly required.

In order to minimize the deterioration of the video quality occurring inthe tandem-connected encoder and decoder, it is necessary to make thequantization steps used in the compression and encoding and theexpansion and decoding the same. The quantization steps must also beheld together with the compressed video data.

When performing compression and encoding without performing motioncompensation processing, as disclosed in for example Japanese UnexaminedPatent Publication (Kokai) No. 5-284458 (related U.S. Pat. No.5,389,973) and Japanese Unexamined Patent Publication (Kokai) No.6-319112, by using the superior "back search" method of utilizing theproperty that the sum of the remainders of the DCT coefficients becomesthe relative minimum when using the quantization step used in theprevious compression and encoding or the quantization step of a multipleof the same and searching for the quantization step giving the smallestrelative minimum as the optimum quantization step, it is possible tomake the quantization steps equal between the time of compression andencoding and the time of expansion and decoding and thus prevent thedeterioration of the video quality.

However, in a case where the GOP is of a 2-frame structure containingone intra-picture and one B picture or a case where the GOP is of a15-frame structure, in order to suppress the deterioration of the videoquality at the time of tandem connection, rather than matching thequantization steps, it is first more important to compress and encodethe same pictures to the same type of pictures (picture types) eachtime, that is, to match phases of GOPs in each compression and encoding.

When the GOPs are out of phase, the above back search method can nolonger be used. In addition, the same pictures end up being compressedand encoded to different picture types, for example, a picture expandedand decoded from a B picture or a P picture is compressed and encoded toan intra-picture. A large amount of the video information isconsequently lost with each compression and encoding and the quality ofpicture is greatly deteriorated.

In order to deal with such a problem, as disclosed in for exampleJapanese Unexamined Patent Publication (Kokai) No. 6-284414 (related toU.S. Pat. Ser. No. 08/477,855), the method may be considered ofmultiplexing and outputting the picture type and the decoded video dataat the time of expansion and decoding and having the encoder perform thecompression and encoding by matching the phases of the GOPs by referringto the multiplexed picture type.

According to the method disclosed in Japanese Unexamined PatentPublication (Kokai) No. 6-284414, however, the information of thepicture type ends up being multiplexed on a part of the video data otherthan the valid pixels. When, for example, there are operation desks(switchers) of television broadcasting stations or digital VTRs etc. ofdifferent systems between the tandem connected encoder and decoder,there is a possibility in that the information of the picture type willbe lost due to blanking or the like.

When the information of the picture type is lost or the information ofthe picture type is replaced by other information or random data in thisway, there is a possibility that the next encoder will erroneouslydetect the random data etc. as the information of the picture type,encode by the wrong picture type, and conversely cause a greaterdeterioration of the quality of the video.

DISCLOSURE OF THE INVENTION

The present invention was made so as to solve the above problem and hasas an object thereof to provide a video data compression apparatuscapable of automatically detecting the picture type of the previous timeof compression and encoding at the encoder side and performing thecompression and encoding by matching the GOPs in phase even ifinformation of the picture type is not particularly multiplexed on thevideo pixel data, and a method of the same.

The video data compression apparatus according to the present inventioncompresses an intra-picture detecting means for detecting a picturecompressed and encoded to an intra-picture in the previous compressionprocessing among pictures of video data obtained by expanding video datawhich was compressed the previous time to a combination ofintra-pictures and non-intra-pictures; a picture type judging means forjudging to which picture type between an intra-picture and anon-intra-picture each of the pictures of the video data was compressedto in the compression processing based on an interval of detectedintra-pictures; and a video data compressing means for compressing eachof the pictures of the video data to the same picture type as that inthe previous compression processing.

Preferably, in the video data compression apparatus, the intra-picturedetecting means compresses an orthogonal transforming means fororthogonally transforming each of the pictures of the video data forevery macroblock to generate orthogonally transformed data; a dividingmeans for dividing the orthogonally transformed data for everymacroblock of each of the pictures of the video data generated by theorthogonal transforming means by each of a plurality of quantizationsteps; a remainder sum calculating means for calculating the sum of theremainders of the results of division by the plurality of quantizationsteps generated by the dividing means of the orthogonally transformeddata for every macroblock of each of the pictures of the video data: anda detecting means for detecting whether or not a picture of the videodata was compressed and encoded to an intra-picture in the previouscompression processing based on whether or not there is a relativeminimum of the sum of the remainders.

Preferably, the intra-picture detecting means of the video datacompression apparatus compresses an orthogonal transforming means fororthogonally transforming part of the macroblocks of each of pictures ofthe video data to generate orthogonally transformed data; a dividingmeans for dividing the orthogonally transformed data of part of themacroblocks of each of the pictures of the video data generated by theorthogonal transforming means by each of the plurality of quantizationsteps; a remainder sum calculating means for calculating the sum of theremainders of each of the results of division by the plurality ofquantization steps by the dividing means of the orthogonally transformeddata of part of the macroblocks of each of pictures of the video data;and a detecting means for detecting whether or not a picture of thevideo data was compressed and encoded to an intra-picture in theprevious compression processing based on whether or not there is arelative minimum of the sum of remainders.

Preferably, the intra-picture detecting means of the video datacompression apparatus compresses a quantization step selecting means forselecting the quantization step giving the smallest relative minimum ofthe sum of remainders; and the video data compressing means has aquantizing means for quantizing the video data by using the selectedquantization step.

Preferably, the intra-picture detecting means of the video datacompression apparatus detects a picture compressed and encoded to anintra-picture in the previous compression processing before the videodata compressing means compresses the video data.

Further, the video data compression apparatus of the present inventioncompresses a compression processing discriminating means fordiscriminating whether or not the input video data has gone throughcompression processing in the past; a quantization step generating meansfor reproducing the quantization step in the compression processing togenerate a first quantization step when it is discriminated that theinput video data has gone through compression processing in the past andgenerating a predetermined second quantization step when it isdiscriminated that the input video data has not gone through compressionprocessing; and a video data compressing means for compressing the inputvideo data by using the generated first quantization step or secondquantization step.

Preferably, the quantization step generating means of the video datacompression apparatus compresses an orthogonal transforming means fororthogonally transforming each of the pictures of the video data forevery macroblock to generate orthogonally transformed data; a dividingmeans for dividing the orthogonally transformed data for everymacroblock of each of the pictures of the generated video data by eachof the plurality of quantization steps; a remainder sum calculatingmeans for calculating the sum of the remainders of each of the resultsof division of the orthogonally transformed data for every macroblock ofeach of the pictures of the video data by the plurality of quantizationsteps; and a determining means for determining the quantization stepgiving the smallest relative minimum of the sum of remainders as thefirst quantization step.

Preferably, the video data compression apparatus further compresses apicture type discriminating means for discriminating to which picturetype of an intra-picture or non-intra-picture each of the pictures ofthe input video data was compressed to in the compression processingwhen the input video data has gone through compression processing forgenerating intra-pictures and non-intra-pictures; and the video datacompressing means compresses each of the pictures of the inputcompressed video data to the same picture type as that in thecompression processing when the input video data has gone throughcompression processing for generating the intra-pictures andnon-intra-pictures after compression.

Preferably, the discriminating means of the video data compressionapparatus discriminates whether or not the input video data has gonethrough compression processing by comparing the sum of remainders and apredetermined threshold and further has a threshold adjusting means foradjusting a threshold in accordance with which picture type of anintra-picture or non-intra-picture each of the pictures of the inputvideo data was compressed to in the compression processing.

Preferably, the quantization step generating means of the video datacompression apparatus generates a second quantization step only in acase where the order of picture types of the input video data input inthe previous compression processing satisfies a predetermined condition.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a view of the configuration of a video data processing systemin which an encoder according to the present invention is used.

FIG. 2 is a view of the configuration of an encoder according to thepresent invention in a first embodiment shown in FIG. 1.

FIG. 3 is a flow chart illustrating the content of processing of a backsearch unit and a picture type control unit of the encoder shown in FIG.1 and FIG. 2.

FIG. 4 is a view of the configuration of the encoder of a modificationof the first embodiment.

FIG. 5 is a view of the configuration of the encoder according to thepresent invention in a second embodiment.

FIG. 6 is a view of the configuration of a decoder shown in FIG. 1.

FIG. 7 is a flow chart illustrating an operation of a video indexdetection unit of the encoder shown in FIG. 5.

BEST MODE FOR WORKING THE INVENTION

First Embodiment

Below, a first embodiment of the present invention will be explained.

Background of the First Embodiment

For example, when dubbing video data by using a plurality of VTRapparatuses among television broadcasting stations, in order to expandand decode video data which has been already compressed and encoded bythe MPEG2 method and compress and encode the same again, there sometimesarises the need for connecting the encoder and the decoder in tandem.Where the compression and encoding and the expansion and decoding ofvideo data are repeated in this way, the quality of picture isdeteriorated.

In order to minimize the deterioration of the quality of picture whenrepeatedly performing the compression and encoding and the expansion anddecoding of video data, it is important that the quantization steps usedin the compression and encoding and the expansion and decoding the sameby the above back search or the like and, further, to match the phasesof the GOPs whenever performing the compression and encoding.

When the GOPs are out of phase, the above back search method can nolonger be used. In addition, the same pictures end up being compressedand encoded to different picture types, for example, a picture expandedand decoded from a B picture or a P picture is compressed and encoded toan intra-picture. A large amount of the video information isconsequently lost each time performing the compression and encoding andtherefore the quality of picture is greatly deteriorated.

The encoder 2 (2a, 2b) shown in the first embodiment was made in orderto solve the above problem and is constituted so as to be able toautomatically detect the picture type of the previous compression andencoding at the encoder side and compress and encode the same bymatching the GOP phase even if the information of the picture type isnot particularly multiplexed with the valid pixel data.

Video Data Processing System 1

Below, an explanation will be made of a video data processing system 1in which the encoder and the decoder for video data are connected intandem. The encoder according to the present invention is used in thevideo data processing system 1.

FIG. 1 is a view of the configuration of the video data processingsystem 1 in which the encoder 2 according to the present invention isused.

As shown in FIG. 1, the video data processing system 1 adopts astructure in which encoders (encoder 1, encoder 2) 2a and 2b anddecoders (decoder 1, decoder 2) 4a and 4b are connected in series(tandem connected) via a VTR, hard disk drive, or other recordingapparatus or communication lines or transmission lines and otherrecording and transmission apparatuses (brr channels) 3a to 3c.

Note that even in a case where the configuration of the video dataprocessing system 1 is not clearly adopted and even in a case where, forexample, a plurality of VTRs for compressing and encoding inputnon-compressed video data by the MPEG2 method or the like, recording thesame on a VTR tape, and expanding and decoding the same for output atthe time of reproduction are connected for dubbing the video data, theroute through which the video data passes becomes substantially the sameas that of the video data processing system 1. Further, the encoders 2(2a, 2b) exhibit the characteristic effect to the present invention whennon-compressed video data is compressed and encoded to GOPs including aplurality of types of pictures.

In the video data processing system 1, the encoder 2a compresses andencodes the non-compressed video data (input video data) input from anexternal portion into units of GOPs containing a plurality of types ofpictures by an MC-DCT method such as the MPEG2 method to generate thecompressed video data (compressed and encoded bit stream) and transmitsthe same via the recording and transmission apparatus 3 (3a) to thedecoder 4a.

The decoder 4a expands and decodes the compressed video data input fromthe encoder 2a via the recording and transmission apparatus 3a to returnthis to for example the non-compressed (full bit) video data for examplefor a D-1 digital VTR designed for editing etc. and transmits the samevia the recording and transmission apparatus 3 (3b) to the encoder 2b.

The encoder 2b compresses and encodes the full bit video data input fromthe decoder 4a via the recording and transmission apparatus 3b by thesame method as that of the encoder 2a and transmits the same via therecording and transmission apparatus 3 (3c) to the decoder 4b.

The decoder 4b expands and decodes the compressed video data input fromthe encoder 2b via the recording and transmission apparatus 3c in thesame way as the decoder 4a and outputs the same as the output videodata.

Note that, in the video data processing system 1, three or more stagesof tandem-connected encoders 2, recording and transmission apparatuses3, and decoders 4 are sometimes contained in accordance with need. Thecomponents of the third and subsequent stages perform the compressionand encoding, transmission, and expansion and decoding of the video datain the same way as those of the second stage and previous stage.

Further, in FIG. 1, as the recording and transmission apparatus 3blabeled as the full bit channel, other than an apparatus for simplytransmitting or recording and reproducing the expanded and decoded fullbit video data, for example, an apparatus for converting the expandedand decoded video data from the digital to analog (D/A) format andrecording the same in an analog VTR apparatus, an apparatus forconverting this again from the analog to digital (A/D) format to returnthe same to digital video data, or an apparatus for editing andprocessing the video data via a switcher or special effect apparatus arealso included. In such apparatuses as well, there is a possibility ofloss of the information of the picture type recorded together with thevideo data.

Encoder 2 (2a, 2b)

FIG. 2 is a view of the configuration of the encoder 2 (2a, 2b)according to the present invention in the first embodiment shown in FIG.1.

As shown in FIG. 2, the encoder 2 is constituted by a compression andencoding unit 20 and a compression control unit 24.

The compression and encoding unit 20 is constituted by a picturerearrangement unit 200, a scanning, conversion, and blocking unit 202, amotion detection unit 204, FIFOs 206 and 220, a subtraction circuit 207,a DCT unit 208, a quantization unit 210, a variable length coding unit(VLC) 212, an inverse quantization unit 214, an inverse DCT (intra DCT)unit 216, an addition circuit 218, and a motion compensation unit 222.

The compression control unit 24 is constituted by a motion compensationunit 240, a subtraction circuit 242, a DCT unit 244, a prediction unit246, a back search unit 248, and a picture type control unit 250.

The encoder 2, using these components, detects the GOP phase in theprevious compression and encoding from the input video data (video in)which already has gone through the compression and encoding and theexpansion and decoding by the MPEG2 method or the like at least one timeand, at the same time, reproduces the quantization step in the previouscompression and encoding by the back search method, compresses andencodes the input video data again by the quantization step and GOPphase the same as those of the previous time, and thereby prevents thedeterioration of the quality of picture when tandem connecting anencoder and decoder and repeatedly performing the compression andencoding and the expansion and decoding of the video data.

Components of the Encoder 2

Below, an explanation will be given of each component of the encoder 2.

Compression and Encoding Unit 20

The compression and encoding unit 20 performs the motion compensationprocessing, DCT processing, and variable length coding processing withrespect to the input video data to compress and encode the same in thesame way as a general encoder of the MPEG2 system.

In the compression and encoding unit 20, under the control of thepicture type control unit 250, the picture rearrangement unit 200rearranges the pictures of the input video data to an order suited tothe compression and encoding in accordance with which picture type thepicture of the input video data will become after the compression andencoding and outputs the result to the scanning, conversion, andblocking unit 202.

The scanning, conversion, and blocking unit 202 converts the video datainput from the picture rearrangement unit 200 from a field to frameformat, divides it into macroblocks, and outputs the result to themotion detection unit 204 and the motion compensation unit 240 of thecompression control unit 24.

The motion detection unit 204 outputs the video data input from thescanning, conversion, and blocking unit 202 to the FIFO 206 and thesubtraction circuit 242 of the compression control unit 24 and, at thesame time, processes the video data input from the scanning, conversion,and blocking unit 202 in units of macroblocks to detect the motionthereof, generates a motion vector indicating the motion of the video,and outputs the same to the motion compensation unit 240 and FIFO 220.

The FIFO 206 buffers the video data input from the motion detection unit204 to give a delay of exactly a time required for processing(predictive encoding processing) in the DCT unit 244, the predictionunit 246, and the back search unit 248 of the compression control unit24 and outputs the result to the subtraction circuit 207.

The subtraction circuit 207 outputs the video data of pictures whichbecome intra-pictures after the compression and encoding among picturescontained in the video data input from the FIFO 206 as it is to the DCTunit 208.

Further, the subtraction circuit 207 subtracts the output video data ofthe motion compensation unit 222 from the video data of the pictureswhich become P pictures or B pictures after the compression and encodingamong pictures contained in the video data input from the FIFO 206 togenerate predictive error data and outputs the same to the DCT unit 208.

The DCT unit 208 performs the DCT processing on the video data whichwill become intra-pictures after the compression and encoding input fromthe subtraction circuit 207 and the predictive error data of the videodata which will become P pictures or B pictures after the compressionand encoding and outputs the DCT coefficients obtained as the result ofthe DCT processing to the quantization unit 210.

The quantization unit 210 quantizes the DCT coefficients input from theDCT unit 208 by the quantization steps indicated by the quantizationindex input from the back search unit 248 of the compression controlunit 24 and outputs the same as the quantized data to the variablelength coding unit 212 and the inverse quantization unit 214.

The variable length coding unit 212 performs variable length coding onthe quantized data input from the quantization unit 210 by for examplethe run length encoding method and outputs the same as the output videodata (stream out).

The inverse quantization unit 214 performs the reverse processing tothat of the quantization unit 210 with respect to the input quantizeddata to reproduce the DCT coefficients and outputs the same to theinverse DCT unit 216.

The inverse DCT unit 216 performs the reverse processing to that of theDCT unit 208 with respect to the input DCT coefficients to reproduce thevideo data and outputs the same to the addition circuit 218.

The addition circuit 218 adds the video data input from the inverse DCTunit 216 and the video data input from the motion compensation unit 222to reproduce the video data and outputs the same to the motioncompensation unit 222.

The FIFO 220 buffers the motion vector input from the motion detectionunit 204 to delay the same by exactly a time required for the processingof the FIFO 206 to the addition circuit 218 and outputs the same to themotion compensation unit 222.

The motion compensation unit 222 performs motion compensation processingwith respect to the video data input from the addition circuit 218 usingthe motion vector input from the FIFO 220 and outputs the result to thesubtraction circuit 207 and the DCT unit 208.

Compression Control Unit 24

The compression control unit 24 detects the quantization step and GOPphase in the previous compression and encoding of the input video dataand controls the compression and encoding unit 20 so that they coincide.Further, the compression control unit 24 calculates the quantizationstep giving a total amount (data rate) of the output video data outputfrom the variable length coding unit 212 of not more than thepermissible value of the output video data for each time (unit period)of generation of one to several GOPs worth of compressed video data (forexample, transmission capacity of the transmission line) and almostequal to this permissible value based on the complexity of the patternof the input video data and the speed of motion (difficulty of pattern(difficulty)) and sets the same in the quantization unit 210 in the formof a quantization index.

In the compression control unit 24, the motion compensation unit 240performs motion compensation processing with respect to the video datainput from the scanning, conversion, and blocking unit 202 by using themotion vector input from the motion detection unit 204 in the same wayas the motion compensation unit 222 of the compression and encoding unit20 and outputs the result to the subtraction circuit 242.

The subtraction circuit 242 subtracts the motion compensated video datainput from the motion compensation unit 240 from the video data inputfrom the motion detection unit 204 in the same way as the subtractioncircuit 207 of the compression and encoding unit 20 so as to generatethe video data of intra-pictures and the predictive error data of the Ppictures or the B pictures and outputs the same to the DCT unit 244.

The DCT unit 244 performs DCT on the video data of the intra-picturesinput from the subtraction circuit 242 and the predictive error data ofthe P pictures or B pictures in the same way as the DCT unit 208 of thecompression and encoding unit 20 so as to generate the DCT coefficientsobtained as the result of the DCT processing and outputs the same to theprediction unit 246.

The prediction unit 246 outputs the DCT coefficients input from the DCTunit 244 to the back search unit 248.

Further, the prediction unit 246 quantizes the DCT coefficients inputfrom the DCT unit 244 by the quantization step (fix-q) of a fixed valuefor every unit period using as unit periods the time for generation offor example one to several GOPs worth of the compressed video data togenerate the quantized data.

Further, the prediction unit 246 estimates the difficulty of pattern ofthe input video data for every unit period based on a target data amountset from an external portion by the user or the like of the video dataprocessing system 1 (encoder 2) and indicating the permissible value anda data amount (generated code amount) of the generated quantized data.

Further, the prediction unit 246 allocates a larger data amount (daterate) to a portion of the input video data with a difficult pattern inaccordance with the estimated difficulty of pattern of the input videodata and allocates a smaller data amount (data rate) to the portion ofthe input video data with a simple pattern so as to hold the quality ofthe output video data high as a whole and, in addition, calculates aquantization index indicating the quantization step which should beactually used for every unit period so that the total amount of theoutput video data does not exceed the above permissible value andoutputs the same to the back search unit 248.

Note that, in the prediction unit 246, it is also possible to adopt forexample a method of quantizing the DCT coefficients input from the DCTunit 244 to generate the quantized data by using some temporaryquantization value, comparing the data amount (generated code amount) ofthe generated quantized data and the target data amount (permissiblevalue), and predicting the optimum quantization step by a binary treesearch according to which is larger [binary search] in addition to themethod of quantizing the DCT coefficients by the above quantization stepof a fixed value to predict the quantization index.

Summary of Processing of Back Search Unit 248

The back search unit 248 detects the intra-picture in the previouscompression and encoding based on the quantization index input from theprediction unit 246 and the DCT coefficients input from the DCT unit 244via the prediction unit 246 and outputs the result of detection to thepicture type control unit 250.

Further, the back search unit 248 decides whether or not the input videodata has gone through one or more times of compression and encoding by aback search, generates a quantization index indicating the quantizationstep used in the previous compression and encoding, and sets the same inthe quantization unit 210 of the compression and encoding unit 20.

That is, the back search unit 248 divides the DCT coefficients inputfrom the DCT unit 244 via the prediction unit 246 by the quantizationstep indicated by the quantization index predicted by the predictionunit 246 and the value near this and, when there is a quantization stepgiving a sum of remainders of the result of division of a considerablysmall value, judges the quantization step indicating this considerablysmall value as the quantization step used in the previous compressionand encoding and outputs the quantization index indicating thisquantization step to the quantization unit 210.

Details of Processing of Back Search Unit 248

Details of the processing for detection of an intra-picture of the inputvideo data by the back search unit 248 will be explained next.

The processing for detection of the GOP phase in the back search unit248 is carried out by taking note of the property that the sum ofremainders of the DCT coefficients found by the back search is aconspicuous relative minimum only when a picture expanded and decodedfrom an intra-picture contained in the input video data (also simplyreferred to as an "intra-picture of input video data") is compressed andencoded (intra coded) again to an intra-picture in the next compressionand encoding as well.

The reason for this is that the value of the video data obtained as theresult of the expansion and decoding cannot become a whole multiple ofthe quantization step even if a P picture or B picture is expanded anddecoded by performing inverse DCT processing, inverse quantization, andmotion compensation since the P picture or the B picture is compressedand encoded by DCT processing and quantization for the predictive errordata calculated by the motion compensation processing.

Accordingly, when a picture obtained by expanding and decoding a Ppicture or a B picture (also simply referred to as a "P picture or Bpicture of the input video data") is intra-coded and subjected to backsearch processing, there is no relative minimum point in the sum ofremainders of the DCT coefficients and therefore this cannot be found.

Further, similarly, even if a B picture (P picture) of the input videodata is compressed and encoded again to the same B picture (P picture)and subjected to the back search processing, the motion vector found bythe previous compression and encoding and the motion vector found fromthe video distorted by the next compression and encoding do not becomeidentical. Further, the predictive error data obtained in the nextcompression and encoding does not become identical to the predictiveerror data obtained at the previous compression and encoding due to thedistortion of the video by the previous compression and encoding andexpansion and decoding. Accordingly, even if a B picture or P picture ofthe input video data is compressed and encoded to the same picture typeas that of the previous time, in the back search processing, theprobability of finding the relative minimum point where the sum ofremainders of the DCT coefficients becomes very small is very low.

When utilizing this property in the back search processing for everypicture type explained above, it is possible to automatically detectwhether or not a picture of the input video data was intra-coded theprevious time based on whether or not a remarkable relative minimum ofthe DCT coefficients is produced in the back search processing.

The back search unit 248 can decide whether or not the encoder 2intra-coded an intra-picture of the input video data by deciding whetheror not there is a conspicuous relative minimum in the sum of remaindersof the DCT coefficients, for example, whether or not the ratio of thesum of remainders of the DCT coefficients found by the back searchprocessing in the back search unit 248 with respect to the sum ofremainders where the DCT coefficients are divided by the quantizationstep indicated by the quantization index input from the prediction unit246 becomes less than a certain constant threshold.

In this way, the back search unit 248 can judge the interval ofintra-pictures of the input video data (number N of pictures containedin GOP) by detecting the position of the intra-picture of the inputvideo data and notifies the result of judgement to the picture typecontrol unit 250.

The picture type control unit 250 can judge the interval of P picturesin a GOP (M) based on the interval of the intra-pictures found and thestructure of the GOP (in what order which picture type is contained inthe GOPs, that is, the GOP sequence) used by the encoders 2a and 2b andthe decoders 4a and 4b of the video data processing system 1 and furthercan judge to which picture type each picture of the input video data wascompressed and encoded to the previous time.

The picture type control unit 250 controls the picture rearrangementunit 200 so that each picture of the input video data is compressed andencoded to the same picture type as that of the previous time and GOPphases in the previous compression and encoding and the next compressionand encoding are held based on the information indicating to whichpicture type the input video data judged as explained above wascompressed and encoded to in the previous compression and encoding.

Operation of the Encoder 2

Below, an explanation will be made of the operation of the encoder 2(FIG. 1, FIG. 2) shown in FIG. 1 and FIG. 2 by further referring to FIG.3.

The motion compensation unit 240 of the compression control unit 24performs motion compensation on the video data processed by the picturerearrangement unit 200 and the scanning, conversion, and blocking unit202 of the compression and encoding unit 20.

The subtraction circuit 242 generates video data of the intra-picturesand the predictive error data of the P pictures or B pictures.

The DCT unit 244 performs DCT on the video data of intra-pictures andthe predictive error data of the P pictures or B pictures to generatethe DCT coefficients.

The prediction unit 246 quantizes the DCT coefficients input from theDCT unit 244 by the quantization step (fix-q) of a fixed value for everyunit period using as unit periods the time for generation of for exampleone GOP's worth of the compressed video data to generate quantized data,estimates the difficulty of the input video data based on the generatedcode amount, and further calculates the quantization index for everyunit period.

The back search unit 248 detects a picture intra-coded in the previouscompression and encoding based on the quantization index generated bythe prediction unit 246 and the DCT coefficients generated by the DCTunit 244 and further generates a quantization index indicating thequantization step used in the previous compression and encoding by aback search.

FIG. 3 is a flow chart illustrating the content of processing of theback search unit 248 and the picture type control unit 250 of theencoder 2 (2a, 2b) shown in FIG. 1 and FIG. 2, that is, how the pictureof the input video data to be intra-coded is designated.

As shown in FIG. 3, at step 100 (S100), the back search unit 248 definesa variable j as an initial value l.

At step 102 (S102), the back search unit 248 performs the back searchprocessing on the DCT coefficients obtained as the result of compressionprocessing of the j-th picture of the input video data by the motioncompensation unit 240, the subtraction circuit 242, and the DCT unit 244of the compression and encoding unit 20 and stores a sum R_(min).j ofremainders of the DCT coefficients and a sum R_(j) of remainders of theDCT coefficients by the quantization step obtained by the predictionunit 246 (quantization step before this).

At step 104 (S104), the back search unit 248 compares the variable j andthe number N of pictures of the GOP found heretofore, proceeds to theprocessing of S108 when the variable j is larger than the number N ofpictures, and proceeds to the processing of S106 when the variable j isequal to the number N of pictures or less.

At step 106 (S106), the back search unit 248 adds 1 to the variable j(increments it).

In a loop processing comprised by the processing of S100 to S106, theback search unit 248 performs processing for storing the sum ofremainders R_(sub).j of the DCT coefficients obtained by the back searchprocessing and the sum of remainders R_(j) which the prediction unit 246obtained by quantizing the DCT coefficients by a quantization step of afixed value or by quantizing the same by a quantization step obtained bya binary search for N number of (one GOP's worth of) pictures.

At step 108 (S108), the back search unit 248 compares the minimum value[min (R_(min).j/ R_(j))] of the ratio (R_(min).j/ R_(j)) of N number ofsums of remainders R_(sub).j obtained by the loop processing comprisedof the processing of S100 to S106 with respect to the sum of remaindersR obtained by the quantization step obtained by the prediction unit 246and the predetermined threshold Th.

The back search unit 248 decides that the input video data is anoriginal video which has not gone through the compression and encodingeven one time and proceeds to the processing of S100 when the minimumvalue (min (R_(min).j/ R_(j))) is equal to the threshold Th or more anddecides that the input video data is video data which has already gonethrough compression and encoding (after dubbing) and proceeds to theprocessing of S110 when the minimum value (min (R_(min).j/ R_(j))) isless than the threshold Th.

At step 110 (S110), the back search unit 248 decides the j_(min) -thpicture giving the minimum value (min (R_(min).j/ R_(j))) in theprocessing of S108 as the intra-picture of the input video data andnotifies this to the picture type control unit 250.

At step 112 (S112), the picture type control unit 250 decides whether ornot the j_(min) -th picture is the first picture of the GOP, proceeds tothe processing of S100 when the j_(min) -th picture is the first pictureof the GOP, and proceeds to the processing of S114 when the j_(min) -thpicture is not the first picture of the GOP.

In the processing of S112, the fact that the j_(min) th picture is thefirst picture of the GOP means that the phase (structure) of the GOPcovered by the current back search processing is the same as the phase(structure) of GOP covered by the previous back search processing,therefore the picture type control unit 250 does not have to change thephase of the GOP.

In contrast, in the processing of S112, the fact that the j_(min) -thpicture is not the first picture of the GOP means that the phase(structure) of the GOP covered by current back search processing of theback search unit 248 is different from the phase (structure) of the GOPwas covered by the previous processing of the back search unit 248,therefore the picture type control unit 250 has to change the phase ofthe GOP.

At step 114 (S114), the picture type control unit 250 controls thepicture rearrangement unit 200 so as to change the order ofrearrangement of the pictures so as to intra-code the picture of theN+j_(min) -th input video data.

At step 116 (S116), the picture type control unit 250 enters the numeralj_(min) for the variable j and proceeds to the processing of S102.

The picture rearrangement unit 200 of the compression and encoding unit20 rearranges the order of pictures of the input video data under thecontrol of the picture type control unit 250 explained above.

The scanning, conversion, and blocking unit 202 converts the video datafrom a field to frame format and further forms it into macroblocks.

The motion detection unit 204 processes the video data in units ofmacroblocks, detects the motion thereof, and generates a motion vectorindicating the motion of the video.

The FIFO 206 buffers the video data to give it a predetermined timedelay.

The subtraction circuit 207 generates the predictive error data ofpictures which becomes a P picture or B picture after the compressionand encoding.

The DCT unit 208 performs the DCT processing on the video data whichbecomes an intra-picture after the compression and encoding and thepredictive error data of the video data which becomes a P picture or Bpicture to generate the DCT coefficients.

The quantization unit 210 quantizes the DCT coefficients input from theDCT unit 208 by the quantization step indicated by the quantizationindex generated by the back search unit 248 of the compression controlunit 24, and generates the quantized data.

The variable length coding unit 212 performs variable length coding onthe quantized data input from the quantization unit 210 and outputs theresult as the output video data (stream out).

The inverse quantization unit 214 performs inverse quantizationprocessing on the quantized data to reproduce the DCT coefficients.

The inverse DCT unit 216 performs inverse DCT processing on thereproduced DCT coefficients to reproduce the video data.

The addition circuit 218 adds the video data input from the inverse DCTunit 216 and the video data input from the motion compensation unit 222.

The FIFO 220 buffers the motion vector input from the motion detectionunit 204 to give a predetermined time delay.

The motion compensation unit 222 performs the motion compensationprocessing on the video data input from the addition circuit 218 usingthe motion vector input from the FIFO 220.

Modification

Below, an explanation will be made of a modification of the firstembodiment by referring to FIG. 4.

The encoder 2 (FIG. 1, FIG. 2) is constituted so as to detect thepicture type at the previous compression and encoding when performingthe back search processing for finding the quantization index to be setin the quantization unit 210 of the compression and encoding unit 20 andcontrol the processing for rearrangement of pictures of the picturerearrangement unit 200, therefore the amount of delay is large. Further,it is not possible to quickly change the order of rearrangement ofpictures in the picture rearrangement unit 200.

However, to find the relative minimum point of the sum of remainders ofthe DCT coefficients by the back search processing, it is not alwaysnecessary to calculate the sum of remainders for all DCT coefficients ofthe pictures. It is sufficient to extract some macroblocks in thepicture and checked whether or not there is a relative minimum point inthe sum of remainders.

The next explained modification (encoder 5) of the encoder 2 shown inthe first embodiment takes note of this point and is for increasing theprocessing speed of the encoder 2. It is constituted to separate thefunction of generating the quantization index and the function ofdetecting the phase of the GOP and compresses and encodes the inputvideo data after detecting the GOP phase in advance.

FIG. 4 is a view of the configuration of the encoder 5 of themodification of the first embodiment. Note that, in FIG. 4, the samereferences are given to the same elements as those of the encoder 2among the constituent parts of the encoder 5.

As shown in FIG. 4, the encoder 5 is constituted by the compression andencoding unit 20 and the compression control unit 26.

The compression control unit 26 is structured as the compression controlunit 24 (FIG. 2) plus the GOP phase control unit 28.

The GOP phase control unit 28 is constituted by a block extraction unit280, a DCT unit 282, a prediction unit 284, and a back search unit 286.

In the GOP phase control unit 28 of the compression control unit 26, theblock extraction unit 280 extracts several blocks worth of the videodata from each picture of the input video data and outputs the same tothe DCT unit 282.

The DCT unit 282 performs the DCT processing on the several blocks worthof the video data from the block extraction unit 280 and outputs the DCTcoefficients obtained by the DCT processing to the prediction unit 284.

The prediction unit 284 estimates the difficulty of the pattern of theinput video data by a quantization step (fix-q) of a fixed value or abinary search for every unit period in the same way as the predictionunit 246 of the compression control unit 24, calculates the quantizationindex indicating the quantization step which should be actually used forevery unit period, and outputs the same to the back search unit 286.

The back search unit 286 performs back search processing by using thequantization index input from the prediction unit 284 and the DCTcoefficients input from the DCT unit 282 via the prediction unit 284 inthe same way as the back search unit 248 of the compression control unit24 in the encoder 2, detects the GOP phase (intra-picture) of the inputvideo data, and notifies this to the picture type control unit 250.

The picture type control unit 250 controls the processing of the picturerearrangement unit 200 of the compression and encoding unit 20 accordingto the information indicating the position of the intra-picture inputfrom the back search unit 286 in the same way as that in the encoder 2.

Note that, unlike the encoder 2, in the encoder 5, there is no motioncompensation preceding the detection of the GOP phase (detection ofintra-picture), therefore the back search unit 286 of the GOP phasecontrol unit 28 performs the back search processing on the DCTcoefficients obtained by intra-coding for all pictures of the inputvideo data. Accordingly, as a result, the decision by the GOP phasecontrol unit 28 of whether or not the input video data has already gonethrough compression and encoding becomes very easy.

Further, it does not matter if each component of the encoder 2 (2a, 2b)shown in FIG. 1 and FIG. 2 is constituted by software or by hardware sofar as it can realize an identical function and performance.

Further, each component of the encoder 2 can be replaced by anotherdevice capable of realizing an identical function and performance.

Further, the encoder 2 can be applied to the compression and encoding ofother types of data having redundancy other than video data, forexample, audio data, by making suitable modifications.

Effect

As explained above, according to the encoders 2 and 5, the nextcompression and encoding can be carried out while keeping the GOP phasethe same as that of the previous compression and encoding and thereforedeterioration of the quality of picture in the video data processingsystem 1 shown in FIG. 1 can be prevented.

Further, with the encoders 2 and 5, there is none of the problem oferroneous operation etc. which had occurred in the conventional method,that is, multiplexing the compressed video data and the informationindicating the picture type and performing the next compression andencoding based on that picture type information, when the picture typeinformation is lost or when original video data which has not gonethrough compression and encoding even one time is input.

Further, with the encoders 2 and 5, for example, even when thecompressed video data is returned to an analog video signal and later isrecorded etc. again as digital compressed video data, the compressionand encoding can be carried out with a GOP phase the same as that of thecompressed video data before returning to the analog video data andtherefore the deterioration of the quality of picture can be prevented.

Further, since the encoder 5 detects the GOP phase by using just part ofthe macroblocks of the pictures, the size of the hardware is not greatlyincreased compared with the encoder 2.

Further, according to the encoder 5, the processing time required fordetecting the GOP phase is shortened, so the delay time can be shortenedcompared with the encoder 2.

Second Embodiment

Below, a second embodiment of the present invention will be explained.

In the back search processing of the back search unit 248 of theencoders 2 and 5, the method was adopted of detecting the quantizationstep used in the previous compression and encoding based on whether ornot there is a relative minimum, of a remarkable ratio exceeding apredetermined threshold, in the sum of remainders of the DCTcoefficients, therefore if this threshold is set too small, there is apossibility that a relative minimum of sum of remainders of the DCTcoefficients will be erroneously detected from some of the macroblocksof the pictures of original video data in which there is inherently norelative minimum of sum of remainders of the DCT coefficients and whichhas not gone through compression and encoding even one time.

When the back search unit 248 erroneously detects a sum of remainders ofDCT coefficients and the quantization unit 210 of the compression andencoding unit 20 performs quantization based on the erroneouslygenerated quantization step (quantization index), there is a possibilitythat the DCT coefficients will be quantized by a value larger than theoptimum quantization step and that, as a result, the quality of picturewill considerably deteriorate.

Further, conversely, when the threshold used for the detection of thesum of remainders of the DCT coefficients is set too large, even ifvideo data which has already gone through compression and encoding isinput, there is a possibility that the relative minimum of the sum ofremainders of the DCT coefficients will not be able to be detected insome macroblocks in the pictures. When the relative minimum whichoriginally should be detected cannot be detected, the quantizationprocessing in the next compression and encoding will be carried out by aquantization step different from that in the previous compression andencoding and the quality of picture will considerably deteriorate.

From these viewpoints, it is necessary to suitably select the thresholdused for the detection of the sum of remainders of the DCT coefficients.Solving this problem, however, is difficult. Further, there is also apossibility that the above problem will conspicuously appears accordingto some patterns of input video data.

On the other hand, in an encoder and decoder of the MC-DCT method usingGOPs having a multi-frame structure, it is impossible to reproduce themotion vector the same as that of the previous time in the picture typeto be subjected to the motion compensation processing at the time of thecompression and encoding, therefore the reproducibility of the motionvector and predictive error in the next compression and encoding is lowand, as a result, there is no conspicuous relative minimum in the sum ofremainders of the DCT coefficients of pictures compressed and encoded toB pictures and P pictures in the previous compression and encoding.

Accordingly, even if the back search unit 248 performs the back searchprocessing using a threshold for detecting a picture intra-coded in theprevious compression and encoding, it cannot detect the relative minimumof the DCT coefficients from pictures compressed and encoded to Bpictures and P pictures in the previous compression and encoding.

An object of the second embodiment is to solve this problem, realizeback search processing capable of preventing erroneous detection of thepicture type, and prevent deterioration of the quality of picture whenfor example a plurality of digital VTRs are connected to dub video data.

FIG. 5 is a view of the configuration of the encoder 6 according to thepresent invention in the second embodiment. Note that, in FIG. 5, amongthe components of the encoder 6, the same components as those of theencoder 2 shown in FIG. 2 and the encoder 5 shown in FIG. 4 are giventhe same reference numerals.

As shown in FIG. 5, the encoder 6 is constituted by the compression andencoding unit 20, the compression control unit 30, and a video index(provisional name) detection unit 32. The compression control unit 30 isstructured as the compression control unit 24 of the encoders 2 and 5(FIG. 1, FIG. 2, and FIG. 4) plus a switch (sw) circuit 300. Note thatthe encoder 6 shown in the second embodiment is constituted so as toperform motion compensation in the compression and encoding, but motioncompensation processing is not indispensable.

The encoder 6 is used in place of the encoders 2 and 5 in for examplethe video data processing system 1 (FIG. 1), detects to which picturetype each picture contained in the input video data was compressed andencoded to the previous time in the same way as the encoders 2 and 5,and, further, quantizes the DCT coefficients by the same quantizationstep as that of the previous time to perform the compression andencoding.

Back Search Processing in the Encoder 6

The back search processing in the encoder 6 is changed taking note ofthe property that it is better not to use the back search algorithm forthe original video which has not gone through compression and encodingeven one time and that is it is preferable to apply it to only videodata which has already gone through compression and encoding by anencoder using the same compression and encoding method.

That is, in the encoders 2 and 5 shown in the first embodiment, the backsearch processing is carried out for all pictures of the input videodata and it is expected that valid back search processing will occurwhere there is no relative minimum found in the sum of remainders of theDCT coefficients in the original video data and there is a relativeminimum found in the sum of remainders only in video data which hasalready gone through compression and encoding, but there are cases wherethings do not go as expected.

Therefore, the encoder 6 shown in the second embodiment is constitutedso as to use a video index to discriminate whether the picture of theinput video data is video data which has already gone throughcompression and encoding or is original video data, not perform the backsearch processing if it is discriminated as original video data andvideo data which was compressed and encoded by another method theprevious time, and conversely execute the back search processing onlywhen the input video data was compressed and encoded by the same methodthe previous time and the GOP phase of previous time is the same as theGOP phase in the next compression and encoding.

Method of Detection of Previous Compression and Encoding Method

Next, an explanation will be made of a method of detecting whether ornot the previous compression and encoding method was the same as thenext compression and encoding method.

At present, in the SMPTE, the standard is becoming to multiplexinformation indicating the encoding conditions, referred to as the videoindex, with the video data at the decoder side. By detecting whether ornot a correct video index is multiplexed on the video data, it ispossible to judge at the input part of the encoder 6 whether or not theinput video data was compressed and encoded by the same method theprevious time and whether or not the phase (structure) of the GOP in thenext compression and encoding and the phase of the GOP in the previouscompression and encoding coincide. Below, an explanation will be made ofa case where the decoders 4a and 4b multiplex the video index on thevideo data in the video data processing system 1.

Summary of Operation of Video Index Detection Unit 32

Below, a brief explanation will be made of the operation of a videoindex detection unit 32.

The video index detection unit 32 monitors whether or not the correctvideo index information is multiplexed on the input video data andcontrols the operation of the picture rearrangement unit 200 via thepicture type control unit 250 so that the phase (structure) of the GOPin the next compression and encoding and the phase of the GOP in theprevious compression and encoding coincide only in the case when thecorrect video index information is multiplexed on the input video dataand the phase (structure) of the GOP in the next compression andencoding and the phase of the GOP in the previous compression andencoding coincide and further controls the switch circuit 300 to makethis select an input terminal b and output the quantization step(quantization index) determined by the processing of the back searchunit 248 of the compression control unit 24 to the quantization unit210.

Further, conversely, when it is better not to perform the compressionand encoding with the GOP phase of the previous compression andencoding, such as when there is no video index multiplexed on the inputvideo data at all, when it is multiplexed, but a different compressionand encoding method is indicated, or the same compression and encodingmethod is indicated, but the GOP phase is changed by editing or thelike, the video index detection unit 32 controls the switch circuit 300to make it select an input terminal a and output the quantization step(index) found by a fixed quantization step or binary search by theprediction unit 246 to the quantization unit 210.

Details of Operation of Video Index Detection Unit 32

Below, a detailed explanation will be made of the operation of the videoindex detection unit 32 by referring to FIG. 7.

FIG. 7 is a flow chart illustrating the operation of the video indexdetection unit 32 of the encoder 6 shown in FIG. 5. This illustrates theoperation from when the video index detection unit 32 fetches the videodata of one picture to when the quantization index is generated.

As shown in FIG. 7, at step 200 (S200), the video index detection unit32 of the encoder 6 fetches one picture's worth of the next input videodata.

At step 202 (S202), the video index detection unit 32 decides whether ornot the next input video data could be fetched and terminates theprocessing when the input video data could not be fetched.

At step 204 (S204), the video index detection unit 32 demultiplexes andreads out all of the data of the position at which the video index ofthe input video data should have been multiplexed (for example 3 bytes).

At step 206 (S206), the video index detection unit 32 performs a CRCcheck with respect to the 3 bytes of the read data. Where the result ofthe CRC check is that the 3 bytes of data are correct, the routineproceeds to the processing of S208, while where they are not correct,the routine proceeds to the processing of S216.

At step 208 (S208), the video index detection unit 32 decides whether ornot thee conditions in the next (present) compression and encoding andthe conditions in the previous compression and encoding coincide basedon the data not changed for every picture indicating the GOP structurecontained in the video index, the interval (M) of the P pictures, andthe quantization method (Q₋₋ type). When they coincide, the routineproceeds to the processing of S210, while when they do not coincide, theroutine proceeds to the processing of S216.

At step 210 (S210), the video index detection unit 32 compares thepicture type and frame number (N) contained in the index and the picturetype and frame number (N) expected in the next (present) compression andencoding and decides whether or not they coincide. When they coincide,the routine proceeds to the processing of S212, while when they do notcoincide, the routine proceeds to the processing of S216.

That is, the video index detection unit 32 checks whether or not thedata indicating the picture type and the data indicating the framenumber contained in the video index coincide with those of the expectedpattern. For example, when the GOP has a 2-frame structure of one Bpicture and one intra-picture, it is expected that the first picture ofthe GOP will be the B picture and the second will be the intra-picture.

Accordingly, the video index detection unit 32 decides that the videoindex is correct only in two cases, that is, the case where the data(Frame No.) indicating the frame number contained in the video indexdata is "1" and the data indicating the picture type contained in thevideo index data is the "B picture" and the case where the data (FrameNo.) indicating the frame number contained in the video index data is"2" and the data indicating the picture type contained in the videoindex data is the "intra-picture".

At step 212 (S212), the video index detection unit 32 decides whether ornot the information indicating the GOP phase contained in the indexcoincides with the GOP phase in the next (present) compression andencoding. Where they coincide, the routine proceeds to the processing ofS214, while where they do not coincide, the routine proceeds to theprocessing of S216.

That is, the video index detection unit 32 makes the quantization indexgenerated by the back search unit 248 valid only in the case where theGOP phase in the next (present) compression and encoding and the dataindicating the GOP phase contained in the video index coincide.

At step 214 (S214), the video index detection unit 32 controls theswitch circuit 300 to make it select the input terminal b side andoutput the quantization index generated by the back search unit 248 tothe quantization unit 210 of the compression and encoding unit 20.

That is, the video index detection unit 32 makes the back searchprocessing in the back search unit 248 valid only in the case where allconditions indicated in the processings of S202 and S206 to S212 aresatisfied, controls the switch circuit 300 in the processing of S214 tomake it output the quantization index generated by the back search unit248 to the quantization unit 210.

At step 216 (S216), the video index detection unit 32 makes the switchcircuit 300 select the input terminal a side so that the quantizationunit 210 is controlled to perform the quantization using not thequantization index generated by the back search unit 248, but thequantization index generated by the prediction unit 246 (free runprocessing).

That is, the video index detection unit 32 makes the back searchprocessing in the back search unit 248 invalid where any of theconditions indicated in the processings of S202 and S206 to S212 is notsatisfied and controls the switch circuit 300 at S216 to make it outputthe quantization index generated by the prediction unit 246 to thequantization unit 210.

Decoder 4 (4a, 4b)

FIG. 6 is a view of the configuration of the decoder 4 (4a, 4b) shown inFIG. 1.

In the video data processing system 1 (FIG. 1), when the encoder 6 isused in place of the encoders 2 and 5, the decoders 4a and 4b arestructured as an expansion and decoding unit 40 as shown in FIG. 6 plusa video index multiplexing unit 414.

The expansion and decoding unit 40 is constituted by, in the same way asthe general video data use decoder device, a buffer memory (buffer) 400,a variable length decoding unit (VLD) 402, an inverse quantization unit404, an inverse DCT unit 406, a motion compensation unit 408, a switchcircuit 410, a picture rearrangement unit 412, and a picture typecontrol unit 416.

The expansion and decoding unit 40 expands and decodes the compressedvideo data input from the encoder 2 to generate the full bit video dataand outputs the same to the video index multiplexing unit 414.

The video index multiplexing unit 414 generates a video index indicatingthe previous compression and encoding method and the GOP structure etc.based on the GOP sequence of the compressed video data detected by thepicture type control unit 416, adds the video index to the video datainput from the picture rearrangement unit 412, and outputs the same tothe encoder 2.

Operation of Video Data Processing System 1 in Second Embodiment

Below, an explanation will be made of the operation of the video dataprocessing system 1 (FIG. 1) using the encoder 6 (FIG. 5) and thedecoder 4 (FIG. 6).

The encoder 6 (6a) compresses and encodes the input video data andtransmits the same to the decoder 4 (4a) via the recording andtransmission apparatus 3a.

The decoder 4a expands and decodes the compressed video data input fromthe encoder 6a to generate the full bit video data, multiplexes thevideo index data, and transmits the same via the recording andtransmission apparatus 3b to the encoder 6 (6b).

In the encoder 6b, the video index detection unit 32 (FIG. 5) performsthe processing shown in FIG. 7 whenever one picture's worth of the videodata of worth is input, decides whether or not the video indexmultiplexed on the input video data is correct, controls the switchcircuit 300 to set either of the quantization step (quantization index)generated by the back search unit 248 or the quantization step(quantization index) generated by the prediction unit 246 in thequantization unit 210 of the compression and encoding unit 20, andcontrols the picture rearrangement unit 200 of the compression andencoding unit 20 via the picture type control unit 250 to make itrearrange the pictures of the input video data to the order suited tothe compression and encoding in the encoder 6b.

The picture rearrangement unit 200 of the compression and encoding unit20 and subsequent components and the compression control unit 30compress and encode the input video data in the same way as the encoders2 and 5 and transmits the same via the recording and transmissionapparatus 3c to the decoder 4b.

Note that, as in the encoder 6, when the picture rearrangement unit 200of the compression and encoding unit 20 is controlled based on the videoindex, the picture type at the previous compression and encoding can bedetermined even at the next compression and encoding, therefore it ispossible to optimize the threshold used in the back search processing ofthe back search unit 248 of the compression control unit 30 in the nextand subsequent compressions and encodings in accordance with the picturetype based on the picture type at the previous compression and encoding.

That is, where the picture intra-coded at the previous compression andencoding is also intra-coded the next time, a conspicuous relativeminimum of the sum of remainders of the DCT coefficients easily appearsin the back search processing (FIG. 3). Accordingly, by setting thethreshold used in the back search processing relatively large, erroneousdetection of the relative minimum of the sum of remainders of the DCTcoefficients can be prevented.

Conversely, as mentioned above, when the pictures compressed and encodedto the B pictures and P pictures in the previous compression andencoding are compressed and encoded to the same picture type in the nextcompression and encoding as well, since this is compression and encodingusing motion prediction, the motion vector found in the previouscompression and encoding and the motion vector found from the next andsubsequent distorted video data will not coincide. Even if the sum ofremainders of the DCT coefficients obtained by DCT processing thepredictive error of the non-intra-pictures is sought, not thatconspicuous a relative minimum will appear.

For this reason, when compressing and encoding pictures compressed andencoded to the B pictures and P pictures in the previous compression andencoding to the same picture type in the next compression and encodingas well, if the threshold to be used in the back search processing ofthe back search unit 248 is set relatively high, there is a possibilitythat the back search unit 248 will not be able to find the correctquantization step (quantization index).

Accordingly, when compressing and encoding pictures compressed andencoded to B pictures and P pictures in the previous compression andencoding to the same picture type in the next compression and encodingas well, it is possible to make the back search unit 248 find thecorrect quantization step (quantization index) by making the thresholdused in the back search processing of the back search unit 248 a smallvalue compared with the case of performing the intra-coding.

Modification

Note that, in the encoder 6 shown in FIG. 5, the video index detectionunit 32 controls the switch circuit 300 to change the quantization step(quantization index), but it is also possible to change the operation ofthe video index detection unit 32 so as to directly turn the back searchunit 248 on or off and change the operation of the back search unit 248so as to output the quantization step (quantization index) input fromthe prediction unit 246 to the quantization unit 210 where the operationis turned OFF by the video index detection unit 32 and output thequantization step (quantization index) generated by the back search unit248 itself to the quantization unit 210 when the operation is turned ON.

Further, similar modifications as those made to the encoders 2 and 5(FIG. 1, FIG. 2, and FIG. 4) are possible for the encoder 6.

Effect

As explained above, according to the encoder 6 shown in the secondembodiment, the video index detection unit 32 of the compression andencoding unit 30 makes the back search processing of the back searchunit 248 invalid when the original video data is input, therefore it ispossible to prevent erroneous operation of compressing and encoding theoriginal video data using a large quantization step and thereforepossible to improve the quality of picture of the compressed video dataobtained by compressing and encoding the original video data.

Further, in the encoder 6, the video index detection unit 32 of thecompression and encoding unit 30 makes the back search processing of theback search unit 24 invalid when the original video data is input,therefore the value of the threshold used by the back search unit 248when video data which has already gone through compression and encodingis input can be optimized to small, the detection error of the relativeminimum of the sum of remainders of the DCT coefficients can beprevented, and thus the precision of the back search processing isimproved. Accordingly, as a result, according to the encoder 6, thequality of the compressed video data obtained by compressing andencoding the video data which has already gone through compression andencoding is improved.

As explained above, by the data compression apparatus according to thepresent invention and the method of same, even if information of thepicture type is not particularly multiplexed on the valid pixel data,the picture type at the previous compression and encoding isautomatically detected at the encoder side so the data can be compressedand encoded by matching the GOP phases.

What is claimed is:
 1. A video data compression apparatus comprising:anintra-picture detecting means for detecting a picture compressed andencoded to an intra-picture in the previous compression processing amongpictures of video data obtained by expanding video data which wascompressed the previous time to a combination of intra-pictures andnon-intra-pictures; a picture type judging means for judging to whichpicture type between an intra-picture and a non-intra-picture each ofthe pictures of the video data was compressed to in the compressionprocessing based on an interval of detected intra-pictures; and a videodata compressing means for compressing each of the pictures of the videodata to the same picture type as that in the previous compressionprocessing.
 2. A video data compression apparatus as set forth in claim1, wherein the intra-picture detecting means comprises:an orthogonaltransforming means for orthogonally transforming each of the pictures ofthe video data for every macroblock to generate orthogonally transformeddata; a dividing means for dividing the orthogonally transformed datafor every macroblock of each of the pictures of the video data generatedby the orthogonal transforming means by each of a plurality ofquantization steps; a remainder sum calculating means for calculatingthe sum of the remainders of the results of division by the plurality ofquantization steps generated by the dividing means of the orthogonallytransformed data for every macroblock of each of the pictures of thevideo data; and a detecting means for detecting whether or not a pictureof the video data was compressed and encoded to an intra-picture in theprevious compression processing based on whether or not there is arelative minimum of the sum of the remainders.
 3. A video datacompression apparatus as set forth in claim 1, wherein the intra-picturedetecting means comprises:an orthogonal transforming means fororthogonally transforming part of the macroblocks of each of pictures ofthe video data to generate orthogonally transformed data; a dividingmeans for dividing the orthogonally transformed data of part of themacroblocks of each of the pictures of the video data generated by theorthogonal transforming means by each of the plurality of quantizationsteps; a remainder sum calculating means for calculating the sum of theremainders of each of the results of division by the plurality ofquantization steps by the dividing means of the orthogonally transformeddata of part of the macroblocks of each of pictures of the video data;and a detecting means for detecting whether or not a picture of thevideo data was compressed and encoded to an intra-picture in theprevious compression processing based on whether or not there is arelative minimum of the sum of remainders.
 4. A video data compressionapparatus as set forth in claim 2, wherein the intra-picture detectingmeans comprises a quantization step selecting means for selecting thequantization step giving the smallest relative minimum of the sum ofremainders andthe video data compressing means comprises a quantizingmeans for quantizing the video data by using the selected quantizationstep.
 5. A video data compression apparatus as set forth in claim 2,wherein the intra-picture detecting means detects a picture compressedand encoded to an intra-picture in the previous compression processingbefore the video data compressing means compresses the video data.
 6. Avideo data compression method comprising the steps of:detecting apicture compressed and encoded to an intra-picture in the previouscompression processing among pictures of video data obtained byexpanding video data which was compressed the previous time to acombination of intra-pictures and non-intra-pictures; judging to whichpicture type between an intra-picture and a non-intra-picture each ofthe pictures of the video data was compressed to in the compressionprocessing based on an interval of detected intra-pictures; andcompressing each of the pictures of the video data to the same picturetype as that in the previous compression processing.
 7. A video datacompression method as set forth in claim 6, further comprising the stepsof:orthogonally transforming each of the pictures of the video data forevery macroblock to generate orthogonally transformed data; dividing theorthogonally transformed data for every macroblock of each of thepictures of the video data generated by each of a plurality ofquantization steps; calculating the sum of the remainders of the resultsof division by the plurality of quantization steps generated of theorthogonally transformed data for every macroblock of each of thepictures of the video data; and detecting whether or not a picture ofthe video data was compressed and encoded to an intra-picture in theprevious compression processing based on whether or not there is arelative minimum of the sum of the remainders.
 8. A video datacompression method as set forth in claim 6, further comprising the stepsof:orthogonally transforming part of the macroblocks of each of picturesof the video data to generate orthogonally transformed data; dividingthe orthogonally transformed data of part of the macroblocks of each ofthe pictures of the video data generated by each of the plurality ofquantization steps; calculating the sum of the remainders of each of theresults of division by the plurality of quantization steps of theorthogonally transformed data of part of the macroblocks of each ofpictures of the video data; and detecting whether or not a picture ofthe video data was compressed and encoded to an intra-picture in theprevious compression processing based on whether or not there is arelative minimum of the sum of remainders.
 9. A video data compressionmethod as set forth in claim 7, further comprising the stepsof:selecting the quantization step giving the smallest relative minimumof the sum of remainders and quantizing the video data by using theselected quantization step.
 10. A video data compression method as setforth in claim 7, further comprising the step of detecting a picturecompressed and encoded to an intra-picture in the previous compressionprocessing before compressing the video data.
 11. A video datacompression apparatus comprising:a compression processing discriminatingmeans for discriminating whether or not the input video data has gonethrough compression processing in the past; a quantization stepgenerating means for reproducing the quantization step in thecompression processing to generate a first quantization step when it isdiscriminated that the input video data has gone through compressionprocessing in the past and generating a predetermined secondquantization step when it is discriminated that the input video data hasnot gone through compression processing; and a video data compressingmeans for compressing the input video data by using the generated firstquantization step or second quantization step.
 12. A video datacompression apparatus as set forth in claim 11, wherein the quantizationstep generating means comprises:an orthogonal transforming means fororthogonally transforming each of the pictures of the video data forevery macroblock to generate orthogonally transformed data; a dividingmeans for dividing the orthogonally transformed data for everymacroblock of each of the pictures of the generated video data by eachof the plurality of quantization steps; a remainder sum calculatingmeans for calculating the sum of the remainders of each of the resultsof division of the orthogonally transformed data for every macroblock ofeach of the pictures of the video data by the plurality of quantizationsteps; and a determining means for determining the quantization stepgiving the smallest relative minimum of the sum of remainders as thefirst quantization step.
 13. A video data compression apparatus as setforth in claim 11, further comprising:a picture type discriminatingmeans for discriminating to which picture type of an intra-picture ornon-intra-picture each of the pictures of the input video data wascompressed to in the compression processing when the input video datahas gone through compression processing for generating intra-picturesand non-intra-pictures and the video data compressing means compresseseach of the pictures of the input compressed video data to the samepicture type as that in the compression processing when the input videodata has gone through compression processing for generating theintra-pictures and non-intra-pictures after compression.
 14. A videodata compression apparatus as set forth in claim 13, wherein thediscriminating means discriminates whether or not the input video datahas gone through compression processing by comparing the sum ofremainders and a predetermined threshold and further has a thresholdadjusting means for adjusting a threshold in accordance with whichpicture type of an intra-picture or non-intra-picture each of thepictures of the input video data was compressed to in the compressionprocessing.
 15. A video data compression apparatus as set forth in claim13, wherein the quantization step generating means generates a secondquantization step only in a case where the order of picture types of theinput video data input in the previous compression processing satisfiesa predetermined condition.
 16. A video data compression methodcomprising the steps of:discriminating whether or not the input videodata has gone through compression processing in the past; reproducingthe quantization step in the compression processing to generate a firstquantization step when it is discriminated that the input video data hasgone through compression processing in the past; generating apredetermined second quantization step when it is discriminated that theinput video data has not gone through compression processing; andcompressing the input video data by using the generated firstquantization step or second quantization step.
 17. A video datacompression method as set forth in claim 16, further comprising thesteps of:orthogonally transforming each of the pictures of the videodata for every macroblock to generate orthogonally transformed data;dividing the orthogonally transformed data for every macroblock of eachof the pictures of the generated video data by each of the plurality ofquantization steps; calculating the sum of the remainders of each of theresults of division of the orthogonally transformed data for everymacroblock of each of the pictures of the video data by the plurality ofquantization steps; and determining the quantization step giving thesmallest relative minimum of the sum of remainders as the firstquantization step.
 18. A video data compression method as set forth inclaim 16, further comprising the steps of:discriminating to whichpicture type of an intra-picture or non-intra-picture each of thepictures of the input video data was compressed to in the compressionprocessing when the input video data has gone through compressionprocessing for generating intra-pictures and non-intra-pictures andcompressing each of the pictures of the input compressed video data tothe same picture type as that in the compression processing when theinput video data has gone through compression processing for generatingthe intra-pictures and non-intra-pictures after compression.
 19. A videodata compression method as set forth in claim 18, further comprising thesteps of:discriminating whether or not the input video data has gonethrough compression processing by comparing the sum of remainders and apredetermined threshold and adjusting a threshold in accordance withwhich picture type of an intra-picture or non-intra-picture each of thepictures of the input video data was compressed to in the compressionprocessing.
 20. A video data compression method as set forth in claim18, further comprising the step of generating a second quantization steponly in a case where the order of picture types of the input video datainput in the previous compression processing satisfies a predeterminedcondition.